home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / sc3x04.exe / CONNNUM.C < prev    next >
C/C++ Source or Header  |  1993-06-10  |  3KB  |  78 lines

  1. //   IMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM;
  2. //   :                                                                    :
  3. //   : module:      connnum.c                                             :
  4. //   : abstract:    This module shows how to get the two-byte             :
  5. //   :              connection number by reading the shell's              :
  6. //   :              Connection ID Table.                                  :
  7. //   :                                                                    :
  8. //   : environment: NetWare 3.x v3.11                                     :
  9. //   :              Borland C 3.1                                         :
  10. //   :                                                                    :
  11. //   :  This software is provided as is and carries no warranty           :
  12. //   :  whatsoever.  Novell disclaims and excludes any and all implied    :
  13. //   :  warranties of merchantability, title and fitness for a particular :
  14. //   :  purpose.  Novell does not warrant that the software will satisfy  :
  15. //   :  your requirements or that the software is without defect or error :
  16. //   :  or that operation of the software will be uninterrupted.  You are :
  17. //   :  using the software at your risk.  The software is not a product   :
  18. //   :  of Novell, Inc. or any of subsidiaries.                           :
  19. //   HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM<
  20. //
  21. //                         ****** N O T I C E ******
  22. //
  23. //     This software is considered pre-release and may be used at your own
  24. //     risk and has been provided due to the many requests of our cust-
  25. //     omers.  Support for this module will be provided at the sole
  26. //     discretion of Novell, Inc.
  27. //
  28.  
  29. #include <stdio.h>
  30. #include <string.h>
  31. #include <dos.h>
  32.  
  33. #include "nwsys.h"
  34.  
  35. struct {
  36.     BYTE inUse;
  37.     BYTE order;
  38.     BYTE networkNumber[4];
  39.     BYTE networkNode[6];
  40.     WORD socket;
  41.     WORD receiveTimeOut;
  42.     BYTE routerNode[6];
  43.     BYTE packetSequence;
  44.     BYTE connectionNumber;
  45.     BYTE connectionStatus;
  46.     WORD maximumTimeOut;
  47.     WORD connectionWord;
  48.     BYTE majorServerVersion;
  49.     BYTE serverFlags;        // Low order bit is set if burst mode enabled.
  50.     BYTE minorServerVersion;
  51. } far *connIDTable;
  52.  
  53. #define ID 0
  54.  
  55. int main()
  56. {
  57.     union REGS regs;
  58.     struct SREGS sregs;
  59.     int version;
  60.  
  61.     memset(®s, 0, sizeof(union REGS));
  62.     segread(&sregs);
  63.  
  64.     regs.h.ah = 0xef;
  65.     regs.h.al = 0x03;
  66.  
  67.     intdosx(®s, ®s, &sregs);
  68.  
  69.     if (regs.h.al != 0) {
  70.         printf("Get Connection ID call failed.  Retcode = %d\n",
  71.             regs.h.al);
  72.         return(-1);
  73.     }
  74.     connIDTable = MK_FP(sregs.es, regs.x.si);
  75.     printf("Connection number word = %d\n", connIDTable[ID].connectionWord);
  76.     return(0);
  77. }
  78.